package
{
	import flash.display.Sprite;
	import com.jidolstar.astro.*;	

	/**
	 * Delta-T 테스트 
	 * @author Yongho, Ji
	 * @since 2009.05.12
	 */ 
	public class testDeltaT extends Sprite
	{
		public function testDeltaT()
		{
			super();
			
			trace( "================================ test DeltaT ====================================");
			
			var date:ALDate;
			var deltaT:Number;

			//-----------------------------------------------------------------------
			// 2010-06-15 00:00:00 UT
			//-----------------------------------------------------------------------			
			date = new ALDate( 2010 , 06, 15 );
			deltaT = ALDynamicalTime.deltaT( date.fractionalYear );
			trace( "Date(UT) :" + date.toString( 2 ) ); //2010-06-15 00:00:60.00
			trace( "ΔT : " + deltaT );
			
			//-----------------------------------------------------------------------
			// 333-02-06 06:00:00 UT, Astronomical Algorithms 2nd page.80 Example 10.b
			//-----------------------------------------------------------------------			
			date = new ALDate( 333, 2, 6, 6, 0, 0 );
			deltaT = ALDynamicalTime.deltaT( date.fractionalYear );
			var JDE:Number = ALTimeConverter.JD2JDE( date.JD ); //JDE = JD + deltaT / 86400
			var dateTD:ALDate = new ALDate( JDE );
			trace( "-------------------------" );
			trace( "Date(UT) :" + date.toString( 2 ) );
			trace( "JD : " + date.JD );
			trace( "ΔT : " + deltaT );
			trace( "JDE : " + JDE );
			trace( "Date(TD) : " + dateTD.toString() );
			
			var y:int;
			trace( "-------------------------" );
			for( y = -1999; y < 3000; y++ )
			{
				date = new ALDate( y, 1, 1 );
				deltaT = ALDynamicalTime.deltaT( date.fractionalYear );
				trace( "year : " + y + ", ΔT : " + deltaT.toFixed( 2 ) );
			}
						
		}

	}
}